package StudyCode.summary.mycollection;

import java.util.Iterator;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class GetTheFirstItemOfTheGivenIterable {
	public static <T> T firstItem(Iterable<T> list) {
		if (list != null) {
			Iterator<T> i = list.iterator();
			if (i.hasNext()) {
				return i.next();
			}
		}

		return null;
	}
}
